import request from './request'

// 获取配额包列表
export function getQuotaPackageList(params) {
  return request({
    url: '/api/quota-packages',
    method: 'get',
    params
  })
}

// 获取配额包详情
export function getQuotaPackageDetail(id) {
  return request({
    url: `/api/quota-packages/${id}`,
    method: 'get'
  })
}

// 创建配额包
export function createQuotaPackage(data) {
  return request({
    url: '/api/quota-packages',
    method: 'post',
    data
  })
}

// 更新配额包
export function updateQuotaPackage(id, data) {
  return request({
    url: `/api/quota-packages/${id}`,
    method: 'put',
    data
  })
}

// 删除配额包
export function deleteQuotaPackage(id) {
  return request({
    url: `/api/quota-packages/${id}`,
    method: 'delete'
  })
}

// 获取配额订单列表
export function getQuotaOrderList(params) {
  return request({
    url: '/api/quota-orders',
    method: 'get',
    params
  })
}

// 获取配额订单详情
export function getQuotaOrderDetail(id) {
  return request({
    url: `/api/quota-orders/${id}`,
    method: 'get'
  })
}

// 创建配额订单
export function createQuotaOrder(data) {
  return request({
    url: '/api/quota-orders',
    method: 'post',
    data
  })
}

// 更新配额订单
export function updateQuotaOrder(id, data) {
  return request({
    url: `/api/quota-orders/${id}`,
    method: 'put',
    data
  })
}

// 删除配额订单
export function deleteQuotaOrder(id) {
  return request({
    url: `/api/quota-orders/${id}`,
    method: 'delete'
  })
}

// 获取配额包统计数据
export function getQuotaPackageStatistics() {
  return request({
    url: '/api/quota-package/statistics',
    method: 'get'
  })
}

// 获取用户配额信息
export function getUserQuotaInfo(userId) {
  return request({
    url: `/api/quota/user/${userId}`,
    method: 'get'
  })
}

// 更新用户配额
export function updateUserQuota(userId, data) {
  return request({
    url: `/api/quota/user/${userId}`,
    method: 'put',
    data
  })
}

// 获取配额销售统计
export function getQuotaSalesStatistics(params) {
  return request({
    url: '/api/quota/sales-statistics',
    method: 'get',
    params
  })
}

// 获取配额使用统计
export function getQuotaUsageStatistics(params) {
  return request({
    url: '/api/quota/usage-statistics',
    method: 'get',
    params
  })
}